package org.example.sdk;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class MultiKey<T1, T2> implements Comparable<MultiKey<T1, T2>> {

    private T1 key1;
    private T2 key2;


    @Override
    public int compareTo(MultiKey<T1, T2> o) {
        // nulls last
        if (o == null) {
            return -1;
        }
        // compare key1
        int result = DefaultComparator.compare(this.key1, o.key1);
        if (result != 0) {
            return result;
        }
        // compare key2
        result = DefaultComparator.compare(this.key2, o.key2);
        return result;
    }

}
